﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace eShop.Model
{
    public class OrderItem
    {
        public OrderItem()
        {
        }

        public OrderItem(CartItem cartItem)
        {
            ProductId = cartItem.Product.ProductId;
            ProductName = cartItem.Product.ProductName;
            ProductCode = cartItem.Product.ItemNumber;
            ProductDefaultImage = cartItem.Product.ProductImageUrl;
            ProductDescription = cartItem.Product.ProductDescription;

            StockId = cartItem.Stock.StockId;
            StockDescription = cartItem.Stock.Description;

            UnitPrice = cartItem.UnitPrice;
            UnitWeight = cartItem.Stock.Weight;
            Quantity = cartItem.Quantity;
        }


        #region Property
        public int Id { get; set; }
        public int OrderId { get; set; }

        public int ProductId { get; set; }
        public string ProductName { get; set; }
        public string ProductCode { get; set; }
        public string ProductDefaultImage { get; set; }
        public string ProductDescription { get; set; }

        public int StockId { get; set; }
        public string StockDescription { get; set; }

        public double UnitPrice { get; set; }
        public double UnitWeight { get; set; }
        public int Quantity { get; set; }

        public double TotalWeight { get { return Quantity * UnitWeight; } }
        public double TotalPrice { get { return Quantity * UnitPrice; } }
        #endregion
    }
}
